package si.ibloc.cms.home;

import java.util.List;
import java.util.ArrayList;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;
import si.ibloc.cms.model.User;
import si.ibloc.cms.model.Content;

@Name("userHome")
public class UserHome extends EntityHome<User> {

	public void setUserId(Integer id) {
		setId(id);
	}

	public Integer getUserId() {
		return (Integer) getId();
	}

	@Override
	protected User createInstance() {
		return new User();
	}

	public void wire() {
	}

	public boolean isWired() {
		return true;
	}

	public User getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

   public List<Content> getContents() {
      return getInstance() == null ? null : new ArrayList<Content>(
            getInstance().getContents());
   }
}
